//
//  VOCWordExp.m
//  testapp
//
//  Created by Wallace Wu on 09-3-13.
//  Copyright 2009 Sonic Solutions. All rights reserved.
//

#import "VOCWordExp.h"


@implementation VOCWordExp
@synthesize kind;
@synthesize explanation;
@synthesize function;

-(id)initWithCoder:(NSCoder *)encoder
{
    self = [super init];
    if(self)
    {
        self.kind = (NSUInteger)[encoder decodeIntegerForKey:@"languageKind"];
        self.explanation = [encoder decodeObjectForKey:@"explanation"]; 
        self.function = (NSUInteger)[encoder decodeIntegerForKey:@"function"];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)encoder
{
    [encoder encodeObject:self.explanation forKey:@"explanation"];
    [encoder encodeInteger:(NSInteger)self.kind forKey:@"languageKind"];
    [encoder encodeInteger:(NSInteger)self.function forKey:@"function"];
}

- (BOOL)isEqual:(id)anObject
{
    if([anObject isKindOfClass:[VOCWordExp class]])
    {
        VOCWordExp *exp = (VOCWordExp*)anObject;
        
        if(kind != exp.kind || ![explanation isEqualToString:exp.explanation] || function != exp.function)
        {
            return NO;
        }
        
        return YES;
    }
    
    return NO;
}

-(void)dealloc
{
    [explanation release];
    [super dealloc];
}
@end
